home *** CD-ROM | disk | FTP | other *** search
- /* Graph-Report, V1.0, Jörg Richter */
-
- OPTIONS RESULTS
-
- ADDRESS DataBase
- DBtoFront
-
- GetFileName
- IF RC = 5 THEN EXIT
- out = result
- pos = Lastpos(".",out)
- IF pos > 0 THEN
- out = SubStr(out,1,pos-1)
- out = out || ".graph"
- ok = Open(file,out,R)
- IF ok = 0 THEN EXIT
- title = ReadLn(file)
- axis = ReadLn(file)
- fields = 0
- weiter = 0
- DO WHILE weiter = 0
- str = ReadLn(file)
- weiter = EOF(file)
- IF weiter = 0 THEN DO
- IF Length(str) > 0 THEN DO
- fields = fields + 1
- field.fields = WORD(str,1)
- col.fields = WORD(str,2)
- legende.fields = DELWORD(str,1,2)
- END
- END
- END
- ok = Close(file)
-
- offset = 50
-
- GetMaskSize
- size = result
- width = WORD(size,1)
- height = WORD(size,2)
- Current
- aktuell = result
- Total
- ges = result
-
- Request "_Datensatz|D_atei|_Bereich|_Abbruch" "Welche Daten wollen Sie darstellen ?"
- return = RC
- IF return = 0 THEN EXIT
- IF return = 1 THEN DO
- first = aktuell
- sets = 1
- END
- IF return = 2 THEN DO
- first = 1
- sets = ges
- END
- IF return = 3 THEN DO
- RequestText "Erster Datensatz (1-" || ges || ")"
- IF RC = 5 THEN EXIT
- first = result
- RequestText "Letzter Datensatz (" || first || "-" || ges || ")"
- IF RC = 5 THEN EXIT
- IF result < first THEN EXIT
- IF result > ges THEN EXIT
- sets = result-first+1
- END
-
- ClearMask
- Display Off
- breite = (width-2*offset)%((fields+1)*sets)
-
- /* Größten Wert ermitteln */
- Goto first
- max = 0
- weiter = 1
- DO WHILE weiter <= sets
- i = 1
- DO WHILE i <= fields
- GetData $F || field.i
- IF result > max THEN max = result
- i = i + 1
- END
- RightOne
- weiter = weiter + 1
- END
-
- /* Legende */
- i = 1
- x = width-200
- y = 20
- legheight = fields*15+5
- Box width-210 15 190 legheight 1003
- SetFont helvetica.font 11 0
- DO WHILE i <= fields
- BoxFill x y 10 10 col.i
- Box x y 10 10 1002
- Text x+15 y+8 1 LEFT legende.i
- y = y + 15
- i = i + 1
- END
-
- startx = offset+offset%2+breite%2
- starty = height-offset%2
-
- /* Skalierung bestimmen */
- step = 1
- val = max
- DO WHILE val ~= 0
- val = val % step * step
- step = step * 10
- END
- step = step%100
- mval = max%step+1
- IF mval > 5 THEN
- mval = mval * step
- ELSE DO
- mval = mval * step
- step = step%2
- END
- scale = (height-offset-20-legheight)/mval
-
- xpos = startx-(breite%2)
- /* Y-Achse */
- len = mval*scale%1
- Line xpos starty-len 0 len 1
- y = -1
- val = 0
- SetFont helvetica.font 11 0
- say RC
- DO WHILE y <= len
- Line xpos-5 starty-y 5 0 1
- Text xpos-8 starty-y+3 1 RIGHT val
- val = val + step
- y = y + step*scale%1
- END
-
- /* X-Achse */
- Line xpos starty+1 breite*(fields+1)*sets 0 1
-
- /* Title */
- SetFont helvetica.font 18 0
- Text xpos+5 15+legheight%2 2 LEFT title
- Box xpos legheight%2-3 result+10 25 1003
- SetFont RESET 0
-
- /* Balken malen */
- x = startx
- y = starty
- Goto first
- weiter = 1
- col = 1
- DO WHILE weiter <= sets
- i = 1
- DO WHILE i <= fields
- GetData $F || field.i
- res = result
- IF ~DATATYPE(res,W) THEN res = 0
- val = res*scale%1
- BoxFill x y-val breite-1 val col.i
- Box x y-val breite-1 val 1002
- i = i + 1
- x = x + breite
- END
- IF axis = 0 THEN
- Text startx+(fields*breite)%2+(weiter-1)*((fields+1)*breite) starty+15 1 CENTER (weiter-1)+first
- ELSE DO
- GetData $F || axis
- Text startx+(fields*breite)%2+(weiter-1)*((fields+1)*breite) starty+15 1 CENTER result
- END
- x = x + breite
- RightOne
- weiter = weiter + 1
- END
- WaitCommand title
- Goto aktuell
- Display On
- Show New
-
-